package com.league.zjxn.jetpack.vmodel

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.league.zjxn.base.BaseViewModel
import com.league.zjxn.entity.*
import com.league.zjxn.jetpack.repository.HomeRepository
import com.league.zjxn.jetpack.repository.SameRepository
import com.module.lemlin.http.HttpResponseBody
import com.module.lemlin.http.SubscribeViewModel


class SameViewModel(application: Application) : BaseViewModel(application) {

    private val mSameRepository: SameRepository = SameRepository()

    val sameDetailsLiveData = MutableLiveData<HttpResponseBody<SameDetailsResponse>>()

    fun sameAllianceDetails(id:String){
        setRxLifeScope(SubscribeViewModel(sameDetailsLiveData)) {
            mSameRepository.sameAllianceDetails(id)
        }
    }

    fun sameAboutDetails(id:String){
        setRxLifeScope(SubscribeViewModel(sameDetailsLiveData)) {
            mSameRepository.sameAboutDetails(id)
        }
    }


    val projectDetailsLiveData = MutableLiveData<HttpResponseBody<ProjectDetailsResponse>>()
    fun sameProjectDetails(id:String){
        setRxLifeScope(SubscribeViewModel(projectDetailsLiveData)) {
            mSameRepository.sameProjectDetails(id)
        }
    }

    val leagueDetailsLiveData = MutableLiveData<HttpResponseBody<LeagueDetailsResponse>>()
    fun sameLeagueDetails(id:String){
        setRxLifeScope(SubscribeViewModel(leagueDetailsLiveData)) {
            mSameRepository.sameLeagueDetails(id)
        }
    }

    val trendDetailsLiveData = MutableLiveData<HttpResponseBody<TrendDetailsResponse>>()
    fun sameTrendDetails(id:String){
        setRxLifeScope(SubscribeViewModel(trendDetailsLiveData)) {
            mSameRepository.sameTrendDetails(id)
        }
    }

    val agreeDetailsLiveData = MutableLiveData<HttpResponseBody<AgreeResponse>>()
    fun sameAgreePrivacyDetails(){
        setRxLifeScope(SubscribeViewModel(agreeDetailsLiveData)) {
            mSameRepository.sameAgreePrivacyDetails()
        }
    }


    fun sameAgreeUserDetails(){
        setRxLifeScope(SubscribeViewModel(agreeDetailsLiveData)) {
            mSameRepository.sameAgreeUserDetails()
        }
    }


    fun sameAgreeProtocolDetails(){
        setRxLifeScope(SubscribeViewModel(agreeDetailsLiveData)) {
            mSameRepository.sameAgreeProtocolDetails()
        }
    }
}